import logo from './logo.svg';
// import './App.css';
import {Button} from 'antd';
import 'antd/dist/antd.css';
import React from 'react';
import {HashRouter as Router,Switch,Route,Redirect}from 'react-router-dom';
import {adminRoutes} from './routes'
import Frame from './components/frame/index'
import loginServer from './pages/loginService';
function App() {
  return  loginServer.isLogind()?(
   
      <Frame>
      <Switch>
      <Redirect to='/admin/index' from='/admin'></Redirect>
        {adminRoutes.map(route=>{
          return (<Route
          key={route.path}
          path={route.path}
          exact={true}
          render={
            routeProps=>{
              return <route.component {...routeProps}/>;
            }

          }
          />)
        })

        }
  
 <Redirect to='/404'></Redirect>
      </Switch>
    </Frame>
    
  ):(<Redirect to='/login'></Redirect>);
}

export default App;
